<%@page contentType="text/html;charset=UTF-8"%>
<%@page pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>
<script type="text/javascript">
	function deleteFile(course_id,file_id){
		if(confirm("Are you sure you want to delete this flle?")){
			window.location="delete_instruction.html?course_id="+course_id+"&file_id="+file_id;
		}	
	}

</script>
</head>
<body>
<center>
	<table border="0" cellpadding="0" cellspacing="0" width="70%" class="newsTitle">
		<tr><td colspan="3" height="10"> </td></tr>	
		<tr align="center"><td colspan="3" height="30" style="font-size:14px;"><u>តារាងឯកសារណែនាំ</u></td></tr>
		<tr><td colspan="3" height="10"> </td></tr>
		<tr><td colspan="3" height="10" align="center"><c:out value="${Course[0].COURSE_NAME}"></c:out></td></tr>
		<tr><td colspan="3" height="10"> </td></tr>
		<tr>
			<td align="right" colspan="3">
			<form:form modelAttribute="uploadItem" name="frm" method="post" enctype="multipart/form-data" onsubmit="return Validate();">
			Choose File :&nbsp;<form:input path="fileData" id="txtfile" type="file" /><input type="submit" value="Upload" class="input_button" >
			</form:form>
			</td>
		</tr>
		<tr><td colspan="3">&nbsp;</td></tr>
		<tr class="myuploadheader" align="center">
			<td width="15%" height="25">លេខ</td>	
			<td width="60%">ឈ្មោះឯកសារ</td>	
			<td width="25%">លុបចោល</td>
		</tr>
		<%
			String bgcolor="#EEE";
		%>
		<c:if test="${fn:length(FileList)>0}">
			<c:forEach var="x" begin="0" end="${fn:length(FileList)-1}" step="1" varStatus ="status">
				<%
					bgcolor=(bgcolor=="#EEE")?"#FFF":"#EEE";
				%>
						<tr bgcolor="<%=bgcolor%>" align="center">
							<td align="center" style="border-left:solid 1px #DDD; border-bottom:solid 1px #DDD;"><c:out value="${x+1}"/></td>
							<td align="center" height="40" valign="middle" style="border-left:solid 1px #DDD; border-bottom:solid 1px #DDD;padding-right: 4px; padding-left: 4px;"><c:out value="${FileList[x].FILE_NAME }"></c:out></td>
							<td style="border:solid 1px #DDD; border-top:solid 0px #DDD;"><label style="cursor: pointer; color:#0066FF;" onclick="deleteFile(${FileList[x].COURSE_ID},${FileList[x].FILE_ID})">លុបចោល</label></td>
						</tr>
			</c:forEach>
		</c:if>
		<tr><td colspan="3">&nbsp;</td></tr>
		<tr>
			<td colspan="3" align="center">
				<input type="button" class="input_button" value="រួចរាល់ "  onclick="window.location='course_list.html'">
			</td>
		</tr>
	</table>
</center>
</body>
</html>